package com.itheima.springbootdemo02.controller;

import com.itheima.springbootdemo02.config.SMSConfigProperties;
import com.itheima.springbootdemo02.config.SMSProperties;
import com.itheima.springbootdemo02.config.UserConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class HelloController {
    @GetMapping("/test1")
    public String hello1(){
        //System.out.println(Thread.currentThread());
        return "我是第二个springboot项目" ;

    }
    /*@Value("${sms.username}")
    private String username;
    @Value("${sms.password}")
    private String password;
    @Value("${sms.url}")
    private String url;*/
    @Autowired
    private SMSProperties smsProperties;
    @Autowired
    private SMSConfigProperties smsConfigProperties;
    @Autowired
    private UserConfigProperties userConfigProperties;

    /*@GetMapping("/props1")
    public String props1(){


        return username+"----"+password+"---"+url;

    }*/
    @GetMapping("/props2")
    public SMSConfigProperties props2(){


        return smsConfigProperties;

    }
    @GetMapping("/props3")
    public UserConfigProperties props3(){


        return userConfigProperties;

    }
    @GetMapping("/props4")
    public SMSProperties props4(){


        return smsProperties;

    }
}
